package cn.operation.backend.util;


import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * Title: AP返回结果 Description:返回结果信息格式化
 *
 * @Author :Jonny He
 * @Date :2017年06月01日10:31:26
 * @Version:1.0
 */
public class ResultDTOWithPagination<T> implements Serializable {
    private static final long serialVersionUID = -6820865870078657785L;
    @ApiModelProperty(value = "返回是否成功",required = true,position = 0)
    private boolean success;
    @ApiModelProperty(value = "返回数据",position = 4)
    private T data;

    @ApiModelProperty(value = "返回消息代码",position = 1)
    private String messageCode;
    @ApiModelProperty(value = "返回消息",position = 2)
    private String message;

    @ApiModelProperty(value = "分页对象",position = 3)
    private PageVo pageVo;

    public ResultDTOWithPagination() {
    }

    public ResultDTOWithPagination(boolean success, T data, String message) {
        this.success = success;
        this.data = data;
        this.message = message;
        this.pageVo= new PageVo();
    }

    public ResultDTOWithPagination(boolean success, T data, String message, PageVo pageVo) {
        this.success = success;
        this.data = data;
        this.message = message;
        this.pageVo= pageVo;
    }

    public ResultDTOWithPagination(boolean success, T data, String messageCode, String message, PageVo pageVo) {
        this.success = success;
        this.data = data;
        this.message = message;
        this.messageCode = messageCode;
        this.pageVo= pageVo;
    }



    public ResultDTOWithPagination(boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public ResultDTOWithPagination(boolean success) {
        this.success = success;
    }

    public boolean isSuccess() {
        return this.success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getMessageCode() {
        return this.messageCode;
    }

    public void setMessageCode(String messageCode) {
        this.messageCode = messageCode;
    }

    public PageVo getPageVo() {
        return pageVo;
    }

    public void setPageVo(PageVo pageVo) {
        this.pageVo = pageVo;
    }

    @Override
    public String toString() {
        String data = this.getData() == null?"":this.getData().toString();
        String pageVo = this.getPageVo() == null?"":this.getPageVo().toString();
        return "ResultDTOWithPagination [" +
                "success=" + this.success +
                ", messageCode='" + this.messageCode + '\'' +
                ", message='" + this.message + '\'' +
                ", data={" + data + "}"+
                ", pageVo={" + pageVo + "}"+
                ']';
    }
}

